<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>疫苗厂商配置管理</title>
<meta name="decorator" content="default"/>
<script src="${ctxStatic}/common/change/change.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		initVaccName(bsCompanyConfig.companyCode,bsCompanyConfig.vaccineId);
		initVaccCompanyName(bsCompanyConfig.companyCode,bsCompanyConfig.companyName);
		$(document).on("click","#btnReset",function(){
			$("#areaCodeId").val("");
			$("#areaCodeName").val("");
			$("#vaccineId").val("").select2();
			$("#companyCode").val("").select2();
		});
	});
	var bsCompanyConfig = JSON.parse('${fns:toJson(bsCompanyConfig)}');
	function page(n,s){
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
        return false;
    }
	function down(){
		top.$.jBox.confirm("确认要导出疫苗厂商规则数据吗？","系统提示",function(v,h,f){
			if(v=="ok"){
				$("#searchForm").attr("action","${ctx}/company/bsCompanyConfig/export");
				$("#searchForm").submit();
			}
			$("#searchForm").attr("action","${ctx}/company/bsCompanyConfig/");
		},{buttonsFocus:1});
		top.$('.jbox-body .jbox-icon').css('top','55px');
	}
</script>
<style type="text/css">
	.minWidth {
		min-width: 177px;
	}	
	#contentTable td ,#contentTable th{
		text-align: center;
		padding: 1px 16px;
	}
</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/company/bsCompanyConfig/">疫苗厂商规则列表</a></li>
		<shiro:hasPermission name="company:bsCompanyConfig:edit">
			<li>
				<a href="${ctx}/company/bsCompanyConfig/form?id=${bsCompanyConfig.id}">疫苗厂商规则<shiro:hasPermission name="company:bsCompanyConfig:edit">${not empty bsCompanyConfig.id?'修改':'添加'}</shiro:hasPermission></a>
			</li>
		</shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="bsCompanyConfig" action="${ctx}/company/bsCompanyConfig/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<div class="breadcrumb">
			<table class="table table-bordered">
				<tr>
				    <th>疫苗名称:</th>
					<td>
						<form:select path="vaccineId" id="vaccineId" class="span2 minWidth vaccineCompany" >
						</form:select>
					</td>
					<th>生产企业：</th>
					<td>
						<form:select path="companyCode" id="companyCode" class="span2 minWidth vaccCompanyName">
						</form:select>
					</td>
					<th>启用状态：</th>
					<td>
						<form:radiobuttons path="isEnable" items="${fns:getDictList('is_enable')}"
					        itemLabel="label" itemValue="value" class="required" />
					</td>
				</tr>
				<tr>
					<th>地区</th>
					<td colspan="5">
                        <sys:treeselect2 id="areaCode" name="areaCode" value="${bsCompanyConfig.areaCode}" labelName="areaName" labelValue="${bsCompanyConfig.areaName}"
						title="机构" url="/sys/office/treeData" extId="${office.id}" cssClass="input-medium" allowClear="${office.currentUser.admin}" module="true"/>
					</td>
				</tr>
			</table>
		</div>
		<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
		<input id="btnReset" type="button" class="btn btn-primary" value="重置"/>
		<input onclick="down()" class="btn btn-primary" type="button" value="导出"/>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
			    <th>序号</th>
				<th>区域名称</th>
				<th>疫苗名称</th>
				<th>生产企业</th>
				<th>创建者</th>
				<th>创建时间</th>
				<th>启用状况</th>
				<th>备注</th>
				<shiro:hasPermission name="company:bsCompanyConfig:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="bsCompanyConfig" begin="0" varStatus="status">
			<tr>
				<td>
					${(page.pageNo-1)*page.pageSize+status.index+1}
				</td>
				<td>
					${bsCompanyConfig.areaName}
				</td>
				<td>
					${bsCompanyConfig.vaccineName}
				</td>
				<td>
					${bsCompanyConfig.companyName}
				</td>
				<td>
					${bsCompanyConfig.createByName}
				</td>
				<td>
					<fmt:formatDate value="${bsCompanyConfig.createDate}" pattern="yyyy-MM-dd"/>
				</td>
				<td>
					${fns:getDictLabel(bsCompanyConfig.isEnable, 'is_enable', '') }
				</td>
				<td>
					${bsCompanyConfig.remarks}
				</td>
				<shiro:hasPermission name="company:bsCompanyConfig:edit">
					<td>
		   				<a href="${ctx}/company/bsCompanyConfig/form?id=${bsCompanyConfig.id}">修改</a>
						<a href="${ctx}/company/bsCompanyConfig/delete?id=${bsCompanyConfig.id}" onclick="return confirmx('确认要删除该疫苗厂商规则吗？', this.href)">删除</a>
					</td>
				</shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>